import org.apache.hadoop.hive.ql.exec.UDF;

import java.util.HashMap;
import java.util.Map;

// 此类实现学校类型id的转换
public class UpdateSchoolType extends UDF {

    // 一个静态映射，将学校类型id和要转换的id传入
    public static Map<String, String> school = new HashMap<String, String>();

    static{
        school.put("668","363");
        school.put("665","218");
        school.put("667","362");
        school.put("660","513");
        school.put("661","512");
        school.put("652","311");
        school.put("666","361");
        school.put("669","364");
        school.put("670","365");
        school.put("651","211");
        school.put("662","511");
        school.put("655","321");
        school.put("6100","312");
        school.put("658","371");
        school.put("657","514");
        school.put("650","111");
        school.put("653","342");
        school.put("654","341");
        school.put("663","345");
        school.put("673","369");
        school.put("672","369");
        school.put("671","369");
        school.put("659","369");
        school.put("664","369");
    }

    public String evaluate(String id){
        // 判断，如果有则返回键值对中的value，无则返回"999"
        return school.getOrDefault(id,"999");
    }



}
